home *** CD-ROM | disk | FTP | other *** search
- Path: engnews1.Eng.Sun.COM!taumet!clamage
- From: Michael R Cook <mcook@cognex.com>
- Newsgroups: comp.std.c++
- Subject: Re: Is typeof legal under ANSI C++?
- Date: 13 Apr 1996 23:17:37 GMT
- Organization: Cognex Corporation
- Sender: mcook@cognex.com
- Approved: clamage@eng.sun.com (comp.std.c++)
- Message-ID: <r468b4yml6.fsf@erawan>
- References: <4kgi76$qf1@engnews1.Eng.Sun.COM>
- NNTP-Posting-Host: taumet.eng.sun.com
- X-Nntp-Posting-Host: erawan.cognex.com
- X-Newsreader: September Gnus v0.69/Emacs 19.30
- Content-Length: 525
- Originator: clamage@taumet
-
- "I\qaky P\irez Gonz\alez" <inaky@eneline.es> writes:
-
- > So, my cuestion is that of the subject. Does typeof() conform to ANSI C++?
-
- No, but you're in luck, because you don't really seem to need it:
-
- > template<class T>
- > class A
- > {
- > public:
- typedef T type;
- > virtual T& operator [] (unsigned int i) {return 3; };
- > };
- >
- > template<class T>
- > class B
- > {
- > public:
- virtual T::type operator[] (unsigned int i)
- > {
- > return (*a)[i];
- > };
-
- That solution assumes you can modify the definition of `A'.
-
- Michael.
-
-
- [ comp.std.c++ is moderated. To submit articles: try just posting with ]
- [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
- [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
- [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
- [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
-